package edu.hunau.cxb19.oop.class32.udp.v1;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

/**
 *
 * @author hb
 *
 *         2020-04-23 15:57:24
 */
public class UdpServer {

	public static void main(String[] args) throws Exception {
		String info = "Hello UDP";
		// 封装了一个数据包
		DatagramPacket dp = new DatagramPacket(info.getBytes(), 0, info.length(), InetAddress.getByName("localhost"),
				6000);
		DatagramSocket server = new DatagramSocket(3000);// 服务器端口
		server.send(dp);
		server.close();
	}
}
